package com.mytest;


import java.util.concurrent.TimeUnit;

public class Demo06 {

    public static void main(String[] args) throws InterruptedException {
        Phone phone = new Phone();
        new Thread(phone::sms).start();
        new Thread(phone::call).start();
    }
}

class Phone {
    public synchronized void sms() {

        System.out.println("发短信");
    }

    public synchronized void call() {
        System.out.println("打电话");
    }

}
